package com.liruo.demojsrjpa;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Slf4j
@Aspect
@Component
public class SqlAop {
  @Around("execution(* java.sql.Statement.executeQuery(..))")
  public Object logSql(ProceedingJoinPoint joinPoint) throws Throwable {
    Object proceed = joinPoint.proceed();
    Object[] args = joinPoint.getArgs();
    System.out.println(args);
    return proceed;
  }
}
